<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 *
 *
 *
 * @package     h
 * @subpackage  models
 * @category    models
 * @author      hyw
 * @copyright   copyright (c) 2012
 * @filesource
 */
class Address_county_model extends Base_model {

    protected $_table_name = 'address_county';
    protected $_key_name = 'id';

    function get_by_id($id) {
        $where['relevance'] = $id;
        return $this->fetch(NULL, $where);
    }

    function get_all() {
        $where = array('dtime' => 0);
        return $this->fetch(NULL, $where);
    }
	
	function get_all_new() {
		
		$sql="SELECT * FROM `address_county` WHERE `dtime` ='0' ";
		
        $this->db->query($sql);
		
        return $this->fetch(NULL, $where);
    }

    function get_address_county() {
        
        $where = array('dtime' => 0);
        $result = $this->fetch(NULL, $where);
        $p = array();
        
        foreach ($result as $key => $val) {
            $p[$val->id] = $val->name;
        }
        
        return $p;
        
    }

}
